<script lang="ts" setup>
    import {ref} from "vue";
    // 自定义指令
    // 1.全局注册(directive)
    // 2.局部注册

    let color=ref("purple");
    function changeColor(){
        if(color.value==="red"){
            color.value="green";
        }else{
            color.value="red"
        }
    }
</script>

<template>
    <input type="text" v-getFocus/>
    <a v-setColor="color">12345</a>
    <button @click="changeColor">更改颜色</button>
</template>

<style scoped>

</style>